package com.market.web.controller.system;

import java.io.InputStream;

import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;

import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

@Controller("fileUploadDownloadController")
@Scope("session")
public class FileUploadDownloadController {
	private StreamedContent file;  
    
    public FileUploadDownloadController() {          
       
    }  
  
    public StreamedContent getUserGuide() {  
    	 InputStream stream =  ((ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext()).getResourceAsStream("/public/userGuide.doc");  
         file = new DefaultStreamedContent(stream, "application/msword", "userGuide.doc");  
        return file;  
    }    
}
